<template>
	<view class="container">
		<view class="search">
			<u-search :show-action="false" height="40" action-text="搜索" :animation="true"></u-search>
			<view class="order-title">
				<u-tabs :list="list2" current="0"  lineWidth="30"   lineColor="#f00" 
				:activeStyle="{ color: '#303133', fontSize:'1.73vw', fontWeight: 'bold', transform: 'scale(1.05)' }"
				  itemStyle="padding-left: 25px; padding-right: 25px; height: 44px;" @change="valChange" ></u-tabs>
				<!-- 	<text class="active">全部</text>
				<text>待付款</text>
				<text>待配送</text>
				<text>配送中</text>
				<text>待评价</text> -->
			</view>
		</view>

		<view class="order">
			<view class="order-item" v-for="item in orderLists" :key="item.id">
				<view class="order-status">
					<text>订单编号：{{item.orderNumber}}</text>
					<text>{{item.statusStr}}</text>
				</view>
				<view class="goods-list">
					<view class="goods-item">
						<!-- 商品图片 -->
						<u-image :src="item.goods[0].pic" @click="dindanxiangqing" width="120px"></u-image>

						<view class="goods-info">
							<view class="goods-title">
								<!-- 订单编号 -->
								<text>{{item.goods[0].goodsName}}</text>
								<!-- 状态（待发货 已发货） -->
								<text>{{item.goods[0].property}}</text>
							</view>
							<view class="goods-sale">
								<view class="goods-price">
									<!-- 价格 -->
									<text>￥</text>
									<text>{{item.goods[0].amount}}</text>
								</view>
								<view class="goods-num">{{item.goods[0].number}}</view>
							</view>
						</view>
					</view>
				</view>
				<view class="order-total">
					<text>共计{{item.goods[0].number}}件商品，实付款：</text>
					<text>￥</text>
					<text>{{item.goods[0].number}}*{{item.goods[0].amount}}</text>
					<text>元</text>
				</view>
				<view class="order-operation">
					<text>删除订单</text>
					<text>再来一单</text>
				</view>
			</view>

			<!-- <view class="order-item">
				<view class="order-status">
					<text>订单编号：220817110116050164</text>
					<text>已完成</text>
				</view>
				<view class="goods-list">
					<view class="goods-item">
						<image class="goods-thumb"
							src="https://cdn.it120.cc/apifactory/2019/06/20/9ebdb53d-aa8e-48e6-ba71-2dc8ceea3259.jpg">
						</image>
						<view class="goods-info">
							<view class="goods-title">
								<text>小米8[虚拟商品]</text>
								<text>版本:6GB+128GB,颜色:白色</text>
							</view>
							<view class="goods-sale">
								<view class="goods-price">
									<text>￥</text>
									<text>2999.00</text>
								</view>
								<view class="goods-num">x1</view>
							</view>
						</view>
					</view>
				</view>
				<view class="order-total">
					<text>共计1件商品，合计：</text>
					<text>￥</text>
					<text>2999.00</text>
					<text>元</text>
				</view>
				<view class="order-operation">
					<text>删除订单</text>
					<text>再来一单</text>
				</view>
			</view>
			<view class="order-item">
				<view class="order-status">
					<text>订单编号：220822192416050166</text>
					<text>已完成</text>
				</view>
				<view class="goods-list">
			
					<view class="goods-item">
						<image class="goods-thumb"
							src="https://cdn.it120.cc/apifactory/2019/06/20/b30cd900-8034-4a0d-88af-62f6cf042577.jpg">
						</image>
						<view class="goods-info">
							<view class="goods-title">
								<text>Redmi K20[2种规格]</text>
								<text>版本:6GB+64GB,颜色:火焰红</text>
							</view>
							<view class="goods-sale">
								<view class="goods-price">
									<text>￥</text>
									<text>1999.00</text>
								</view>
								<view class="goods-num">x1</view>
							</view>
						</view>
					</view>
				</view>
				<view class="order-total">
					<text>共计1件商品，合计：</text>
					<text>￥</text>
					<text>1999.00</text>
					<text>元</text>
				</view>
				<view class="order-operation">
					<text>删除订单</text>
					<text>再来一单</text>
				</view>
				<view class="order-operation" >
					
				</view>
			</view> -->
			<view class="gengduo">
				没有更多了
			</view>
		</view>
	</view>





</template>

<script>
	import {
		_order
	} from "../../api/order.js"
	export default {
		data() {
			return {
				orderLists: [],
				
				list2: [{
					name: '全部',
					
					
				}, {
					name: '待发货',
					badge: {
						isDot: false
					}
				}, {
					name: '待付款',
					badge: {
						// value: 5,
					}
				}, {
					name: '待收货',
					
				},{
					name: '待评价',
					
				}
				
				]
			}
		},
		methods: {
			get_order() {
				_order().then(res => {
					console.log(res);
					if (res.code === 0) {
						res.data.orderList.forEach(item => {
							item.goods = res.data.goodsMap[item.id] || {}
						})
						this.orderLists = res.data.orderList
						console.log(this.orderList)


					}
				})
			},

		},
		onReady() {
			this.get_order()

		}
	}
</script>

<style lang="scss" scoped>
	.container {
		margin: 0 auto;
		max-width: 1050rpx;
		position: relative;
		background-color: #f1f1f1;
	}

	.search {
		width: 100%;
		max-width: 1050rpx;
		position: fixed;
		height: 150rpx;
		z-index: 999999;

	}

	.order {
		padding-top: 100px;

	}

	/* shangcheng_xk/pages/order/myorder/myorder.wxss */
	/* 订单标题开始 */
	.order-title {
		// width: 100%;
		display: flex;
		justify-content: space-between;
		font-size: 40rpx;
		max-width: 1050rpx;
		padding: 30rpx 10rpx;
		background-color: #f6f6f6;
	}

	.active {
		font-weight: bold;
		border-bottom: 8rpx solid #ff6700;
		padding: 0 15rpx 10rpx 15rpx;
	}

	/* 订单标题结束 */
	/* 订单内容开始 */

	.order-item:first-child {
		margin-top: 50px;
	}

	.order-item {
		color: #333;
		padding: 15rpx;
		margin: 15rpx 15rpx;
		border-radius: 10rpx;
		font-size: 30rpx;
		margin-top: 50rpx;
		background-color: #fff;
	}

	.order-status {
		font-size: 28rpx;
		display: flex;
		margin-top: 50rpx;
		justify-content: space-between;
	}

	.goods-item {
		display: flex;
		align-items: center;
		border-bottom: 2rpx solid #f6f6f6;
		margin: 15rpx 0;
	}

	.goods-thumb {
		width: 500rpx;
		height: 400rpx;
	}

	.goods-info {
		margin-left: 15rpx;
		flex: 1;
	}

	.goods-title {
		display: flex;
		flex-direction: column;
		margin-top: 15rpx;
	}

	.goods-title text:nth-child(1) {
		font-weight: bold;
	}

	.goods-title text:nth-child(2) {
		color: #999;
		font-size: 26rpx;
	}

	.goods-sale {
		display: flex;
		justify-content: space-between;
		margin: 10rpx 0;
	}

	.goods-price text:nth-child(1) {
		font-size: 26rpx;
		color: #f00;
	}

	.goods-price text:nth-child(2) {
		font-weight: bold;
		color: #f00;
	}

	.order-total {
		text-align: right;
		font-size: 28rpx;
		margin: 10rpx 0;
	}

	.order-total text:nth-child(3) {
		color: #f00;
		font-size: 32rpx;
		font-weight: bold;
	}

	.order-operation {
		text-align: right;
		margin: 15rpx 0 10rpx 0;
	}

	.order-operation text:nth-child(1) {
		background-color: #c6c6c6;
		color: #666;
		padding: 5rpx 30rpx;
		border-radius: 30rpx;
		text-align: center;
		margin-right: 30rpx;
	}

	.order-operation text:nth-child(2) {
		background-color: #ff6700;
		padding: 5rpx 30rpx;
		border-radius: 30rpx;
		text-align: center;
	}

	.gengduo {
		margin: 100px;
		size: 20px;
		color: #999;
		text-align: center;
		padding-bottom: 100px;
	}

	/* 订单内容结束 */
</style>
